CONTENTS | INDEX | PREV | NEXT
strlen
NAME
strlen - returns length of a string
SYNOPSIS
int len = strlen(s);
const char *s;
FUNCTION
The length of the requested string is returned. The string is
scanned until a nul terminator is found and the number of
characters (not including the nul) is returned.
EXAMPLE
#include <stdio.h>
#include <string.h>
#include <assert.h>
main()
{
char buf[32];
int len;
strcpy(buf, "Fu Bar Bear Boo");
len = strlen(buf);
assert(len == 15);
strcat(buf, "xx");
len = strlen(buf);
assert(len == 17);
return(0);
}
INPUTS
char *s; string to obtain length of
RESULTS
int len; length of string
SEE ALSO
strcpy, strcat